<!--$Id: txn_set_timeout.so,v 10.22 2006/12/16 13:52:36 bostic Exp $-->
<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
<!--See the file LICENSE for redistribution information.-->
<html>
<head>
<title>Berkeley DB: DbTxn::set_timeout</title>
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
</head>
<body bgcolor=white>
<table width="100%"><tr valign=top>
<td>
<b>DbTxn::set_timeout</b>
</td>
<td align=right>
<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a>
<a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a></td>
</tr></table>
<hr size=1 noshade>
<tt>
<b><pre>
#include &lt;db_cxx.h&gt;
<p>
u_int32_t
DbTxn::set_timeout(db_timeout_t timeout, u_int32_t flags);
</pre></b>
<hr size=1 noshade>
<b>Description: DbTxn::set_timeout</b>
<p>The DbTxn::set_timeout method sets timeout values for locks or
transactions for the specified transaction.</p>
<p>Timeouts are checked whenever a thread of control blocks on a lock or
when deadlock detection is performed.  In the case of
DB_SET_LOCK_TIMEOUT, the timeout is for any single lock request.
In the case of DB_SET_TXN_TIMEOUT, the timeout is for the life
of the transaction.  As timeouts are only checked when the lock request
first blocks or when deadlock detection is performed, the accuracy of
the timeout depends on how often deadlock detection is performed.</p>
<p>Timeout values may be specified for the database environment as a whole.
See <a href="../api_cxx/env_set_timeout.html">DbEnv::set_timeout</a> and for more information.</p>
<p>The DbTxn::set_timeout method configures operations performed on the underlying
transaction, not only operations performed using the specified
<a href="../api_cxx/txn_class.html">DbTxn</a> handle.</p>
<p>The DbTxn::set_timeout method may be called at any time during the life of the
application.</p>
<p>The DbTxn::set_timeout method
either returns a non-zero error value
or throws an exception that encapsulates a non-zero error value on
failure, and returns 0 on success.
</p>
<b>Parameters</b> <br>
 <b>flags</b><ul compact><li>The <b>flags</b> parameter must be set to one of the following values:
<br>
<b><a name="DB_SET_LOCK_TIMEOUT">DB_SET_LOCK_TIMEOUT</a></b><ul compact><li>Set the timeout value for locks in this transaction.</ul>
<b><a name="DB_SET_TXN_TIMEOUT">DB_SET_TXN_TIMEOUT</a></b><ul compact><li>Set the timeout value for this transaction.</ul>
<br></ul>
 <b>timeout</b><ul compact><li>The <b>timeout</b> parameter is specified as an unsigned 32-bit number
of microseconds, limiting the maximum timeout to roughly 71 minutes.  A
value of 0 disables timeouts for the transaction.</ul>
<br>
<br><b>Errors</b>
<p>The DbTxn::set_timeout method
may fail and throw
<a href="../api_cxx/except_class.html">DbException</a>,
encapsulating one of the following non-zero errors, or return one of
the following non-zero errors:</p>
<br>
<b>EINVAL</b><ul compact><li>An
invalid flag value or parameter was specified.</ul>
<br>
<hr size=1 noshade>
<br><b>Class</b>
<a href="../api_cxx/env_class.html">DbEnv</a>, <a href="../api_cxx/txn_class.html">DbTxn</a>
<br><b>See Also</b>
<a href="../api_cxx/txn_list.html">Transaction Subsystem and Related Methods</a>
</tt>
<table width="100%"><tr><td><br></td><td align=right>
<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a>
</td></tr></table>
<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
</body>
</html>
